<template>
  <el-container class="container">
    <el-header class="header">
      <nav-menu ref="navMenuRef" @selected="handleMenuSelect"></nav-menu>
    </el-header>
    <el-main>
      <keep-alive>
        <router-view></router-view>
      </keep-alive>
    </el-main>
  </el-container>
</template>

<script setup lang="ts">
import { ref } from "vue";
import navMenu from "@/components/nav-menu.vue";
import { useRouter } from "vue-router";

const router = useRouter();

const navMenuRef: any = ref();

/** 选中菜单 */
const handleMenuSelect = (menu) => {
  if (menu) {
    router.push(menu.path);
  }
};
</script>

<style scoped lang="scss">
.container {
  height: 100%;
  width: 100%;
}

.header {
  padding: 0;
  height: 50px;
}
</style>
